/*
 ============================================================================
 Name        : Scheduler.h
 Author      : James McQueen, Corwyn Simpson, Craig Markham
 Version     :
 Date        : 05/14/2012
 Description : TCSS-422 Operating Systems Scheduler
 ============================================================================
 */

#ifndef __SCHEDULER__
#define __SCHEDULER__

#include "ringbuff.h"
#include "PCB.h"
#include "logger.h"

#define NUM_MUTEX 8
//#define NUM_IO_QUEUES 3


/*-------------------- Scheduler --------------------*/
typedef struct
{
	RingBuffer* my_ready_queue;
	RingBuffer** my_io_blocked_queues;
	RingBuffer** my_mutex_blocked_queues;
  int my_mutex_locks[NUM_MUTEX];

	PCB* my_running;
} Scheduler;

/********************* Scheduler Functions *********************/
Scheduler* scheduler_init();

void scheduler_interrupt(Scheduler* sched, int type);

void scheduler_io_request(Scheduler* sched, int num);
void scheduler_mutex_acq(Scheduler* sched, int num);
void scheduler_mutex_give(Scheduler* sched, int num);
void scheduler_mem_write(Scheduler* sched, int num);
void scheduler_mem_read(Scheduler* sched, int num);



#endif /* SCHEDULER_H_ */
